package com.kay.service.impl;

import com.kay.service.DemoService;
import org.apache.dubbo.config.annotation.Service;

import java.util.Random;

/**
 * @Description:
 * @Author: Kay
 * @CreateDate: 2021/9/15$ 12:14$
 * @UpdateUser: Kay
 * @UpdateDate: 2021/9/15$ 12:14$
 */
@Service
public class DemoServiceImpl implements DemoService {
    private Random random = new Random();
    public String methodA() {
        sleep();
        return "methodA";
    }

    public String methodB() {
        sleep();
        return "methodB";
    }

    public String methodC() {
        sleep();
        return "methodC";
    }

    private void sleep() {
        try {
            //随机休眠 0-100 ms
            Thread.sleep(random.nextInt(100));
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
